import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 98152
 * Date: 2024-10-29
 * Time: 20:46
 */
public class Test2 {
    public static int MLS (int[] arr) {
        // write code here
        Arrays.sort(arr);
        int count = 1;
        int max = 1;
        int tmp = arr[0];
        for(int i = 1; i < arr.length;i++) {
            if(arr[i] == tmp + 1) {
                tmp = arr[i];
                count++;
            }else {
                tmp = arr[i];
                count = 1;
            }

            if(max < count) {
                max = count;
            }
        }
        return max;
    }

    public static void main(String[] args) {
        System.out.println(MLS(new int[]{1, 2, 3, 4, 101, 102, 103, 104, 105}));
    }
}
